#include <stdio.h>
#include <stdlib.h>

#include <pthread.h>

typedef struct
{
    int a;
    int b;
} Pthread_args;

void *th_func(void *args)
{
    Pthread_args *a = (Pthread_args *)args;

    pthread_exit((void *)(a->a + a->b));
}

int main()
{
    Pthread_args test = {30, 90};
    pthread_t pid;

    if (pthread_create(&pid, NULL, th_func, (void *)&test) != 0)
    {
        perror("pthread_create error!");
    }

    int *res;
    pthread_join(pid, (void **)&res);

    printf("th_func retval %d\n", (int)res);

    return 0;
}